﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ClassLibrary.Entitty;
using ClassLibrary.DAO;

public partial class Admin_ucControl_loadInfo : System.Web.UI.UserControl
{
    TblInforDAO infoDAO = new TblInforDAO(Global.CONNECTION_STRING);

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadInfo();
        }

    }

    private void loadInfo()
    {
        DataTable dt = infoDAO.GetAll();
        GridView1.DataSource = dt;
        GridView1.DataBind();

    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label lb_des = (Label)e.Row.Cells[2].FindControl("lbInfo");
            if (Server.HtmlDecode(DataBinder.Eval(e.Row.DataItem, "Information").ToString()).Length > 120)
            {
                lb_des.Text = Server.HtmlDecode(DataBinder.Eval(e.Row.DataItem, "Information").ToString()).Substring(100, 250);
            }
            else
            {
                lb_des.Text = Server.HtmlDecode(DataBinder.Eval(e.Row.DataItem, "Information").ToString());
            }

        }
    }
}
